<!-- HTML header for doxygen 1.8.9.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>ROSS: core/clock/armv7l.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <a href="https://github.com/ROSS-org/ROSS">
   <div id="projectname">ROSS
   </div>
   </a>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_af18cf245e3394ab3b436135935cfd6e.html">core</a></li><li class="navelem"><a class="el" href="dir_6924c9c6e6f381ea7419166e601197d9.html">clock</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">armv7l.c</div>  </div>
</div><!--header-->
<div class="contents">
<a href="armv7l_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">        This implementation of an ARM v7 clock reader utilizes the</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">        Performance Monitoring Unit (PMU) on Cortex-A7 chips.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">        Unfortunately, access to the cycle counter from userspace</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">        is disabled by default. A kernel module that enables access</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">        from userspace is required or the system will fault.</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">        An example kernel module that does just that can be found:</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">        https://github.com/nmcglohon/armv7l-userspace-counter.git</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment">        More information can be found:</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">        http://neocontra.blogspot.com/2013/05/user-mode-performance-counters-for.html</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="ross_8h.html">ross.h</a>&gt;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#ifndef __GNUC__</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#  error gcc asm extensions required</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#if ! (defined(__arm__))</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#  error only 32 bit arm platform supported</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="armv7l_8c.html#aa0e91e94650867123687be3011d25c08">   24</a></span>&#160;<span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="structtw__optdef.html">tw_optdef</a> <a class="code" href="armv7l_8c.html#aa0e91e94650867123687be3011d25c08">clock_opts</a> [] =</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;{</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;        <a class="code" href="tw-opts_8h.html#a0e45b7a88a51dca3fe99d31aae9636c4">TWOPT_GROUP</a>(<span class="stringliteral">&quot;ROSS Timing&quot;</span>),</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;        <a class="code" href="tw-opts_8h.html#a62f5bf9c102d88c1523b374c4c1155a3">TWOPT_STIME</a>(<span class="stringliteral">&quot;clock-rate&quot;</span>, <a class="code" href="gtod_8c.html#a460e9a582762cd454d37d9d2704c3a67">g_tw_clock_rate</a>, <span class="stringliteral">&quot;CPU Clock Rate&quot;</span>),</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;        <a class="code" href="tw-opts_8h.html#a38209b0e7568d41f5448ae5f884290a4">TWOPT_END</a>()</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;};</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="armv7l_8c.html#ad791d6ac5a640e8a175a13c72aa3d8e3">   31</a></span>&#160;<span class="keyword">const</span> <a class="code" href="structtw__optdef.html">tw_optdef</a> *<a class="code" href="armv7l_8c.html#ad791d6ac5a640e8a175a13c72aa3d8e3">tw_clock_setup</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;{</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="armv7l_8c.html#aa0e91e94650867123687be3011d25c08">clock_opts</a>;</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;}</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;</div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="armv7l_8c.html#adb6ac59d7f33538cc7ebe7d9e47ec255">   37</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="armv7l_8c.html#adb6ac59d7f33538cc7ebe7d9e47ec255">tw_clock_init</a>(<a class="code" href="structtw__pe.html">tw_pe</a> * me)</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;{</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;        me-&gt;<a class="code" href="structtw__pe.html#ae88aaf9c6fb876f05eccb99ea8d9d40c">clock_time</a> = 0;</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;        me-&gt;<a class="code" href="structtw__pe.html#a153b711a3a208203b485d37973830187">clock_offset</a> = <a class="code" href="aarch64_8h.html#a450cf25fa5291629087ca4198de55757">tw_clock_read</a>();</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;}</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;</div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="armv7l_8c.html#a053d26883c523927f587fa8ad4cc8d5b">   44</a></span>&#160;<a class="code" href="aarch64_8h.html#abcd6b97b84bebf1f961f85cd24b56c60">tw_clock</a> <a class="code" href="armv7l_8c.html#a053d26883c523927f587fa8ad4cc8d5b">tw_clock_now</a>(<a class="code" href="structtw__pe.html">tw_pe</a> * me)</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;{</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        me-&gt;<a class="code" href="structtw__pe.html#ae88aaf9c6fb876f05eccb99ea8d9d40c">clock_time</a> = <a class="code" href="aarch64_8h.html#a450cf25fa5291629087ca4198de55757">tw_clock_read</a>() - me-&gt;<a class="code" href="structtw__pe.html#a153b711a3a208203b485d37973830187">clock_offset</a>;</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;        <span class="keywordflow">return</span> me-&gt;<a class="code" href="structtw__pe.html#ae88aaf9c6fb876f05eccb99ea8d9d40c">clock_time</a>;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;}</div>
<div class="ttc" id="armv7l_8c_html_a053d26883c523927f587fa8ad4cc8d5b"><div class="ttname"><a href="armv7l_8c.html#a053d26883c523927f587fa8ad4cc8d5b">tw_clock_now</a></div><div class="ttdeci">tw_clock tw_clock_now(tw_pe *me)</div><div class="ttdef"><b>Definition:</b> <a href="armv7l_8c_source.html#l00044">armv7l.c:44</a></div></div>
<div class="ttc" id="gtod_8c_html_a460e9a582762cd454d37d9d2704c3a67"><div class="ttname"><a href="gtod_8c.html#a460e9a582762cd454d37d9d2704c3a67">g_tw_clock_rate</a></div><div class="ttdeci">unsigned long long g_tw_clock_rate</div><div class="ttdef"><b>Definition:</b> <a href="ross-global_8c_source.html#l00098">ross-global.c:98</a></div></div>
<div class="ttc" id="armv7l_8c_html_aa0e91e94650867123687be3011d25c08"><div class="ttname"><a href="armv7l_8c.html#aa0e91e94650867123687be3011d25c08">clock_opts</a></div><div class="ttdeci">static const tw_optdef clock_opts[]</div><div class="ttdef"><b>Definition:</b> <a href="armv7l_8c_source.html#l00024">armv7l.c:24</a></div></div>
<div class="ttc" id="armv7l_8c_html_ad791d6ac5a640e8a175a13c72aa3d8e3"><div class="ttname"><a href="armv7l_8c.html#ad791d6ac5a640e8a175a13c72aa3d8e3">tw_clock_setup</a></div><div class="ttdeci">const tw_optdef * tw_clock_setup(void)</div><div class="ttdef"><b>Definition:</b> <a href="armv7l_8c_source.html#l00031">armv7l.c:31</a></div></div>
<div class="ttc" id="aarch64_8h_html_a450cf25fa5291629087ca4198de55757"><div class="ttname"><a href="aarch64_8h.html#a450cf25fa5291629087ca4198de55757">tw_clock_read</a></div><div class="ttdeci">static tw_clock tw_clock_read(void)</div><div class="ttdef"><b>Definition:</b> <a href="aarch64_8h_source.html#l00006">aarch64.h:6</a></div></div>
<div class="ttc" id="structtw__pe_html"><div class="ttname"><a href="structtw__pe.html">tw_pe</a></div><div class="ttdoc">Holds the entire PE state. </div><div class="ttdef"><b>Definition:</b> <a href="ross-types_8h_source.html#l00375">ross-types.h:375</a></div></div>
<div class="ttc" id="structtw__optdef_html"><div class="ttname"><a href="structtw__optdef.html">tw_optdef</a></div><div class="ttdef"><b>Definition:</b> <a href="tw-opts_8h_source.html#l00019">tw-opts.h:19</a></div></div>
<div class="ttc" id="tw-opts_8h_html_a62f5bf9c102d88c1523b374c4c1155a3"><div class="ttname"><a href="tw-opts_8h.html#a62f5bf9c102d88c1523b374c4c1155a3">TWOPT_STIME</a></div><div class="ttdeci">#define TWOPT_STIME(n, v, h)</div><div class="ttdef"><b>Definition:</b> <a href="tw-opts_8h_source.html#l00031">tw-opts.h:31</a></div></div>
<div class="ttc" id="structtw__pe_html_a153b711a3a208203b485d37973830187"><div class="ttname"><a href="structtw__pe.html#a153b711a3a208203b485d37973830187">tw_pe::clock_offset</a></div><div class="ttdeci">tw_clock clock_offset</div><div class="ttdoc">Initial clock value for this PE. </div><div class="ttdef"><b>Definition:</b> <a href="ross-types_8h_source.html#l00396">ross-types.h:396</a></div></div>
<div class="ttc" id="structtw__pe_html_ae88aaf9c6fb876f05eccb99ea8d9d40c"><div class="ttname"><a href="structtw__pe.html#ae88aaf9c6fb876f05eccb99ea8d9d40c">tw_pe::clock_time</a></div><div class="ttdeci">tw_clock clock_time</div><div class="ttdoc">Most recent clock value for this PE. </div><div class="ttdef"><b>Definition:</b> <a href="ross-types_8h_source.html#l00397">ross-types.h:397</a></div></div>
<div class="ttc" id="tw-opts_8h_html_a38209b0e7568d41f5448ae5f884290a4"><div class="ttname"><a href="tw-opts_8h.html#a38209b0e7568d41f5448ae5f884290a4">TWOPT_END</a></div><div class="ttdeci">#define TWOPT_END()</div><div class="ttdef"><b>Definition:</b> <a href="tw-opts_8h_source.html#l00035">tw-opts.h:35</a></div></div>
<div class="ttc" id="ross_8h_html"><div class="ttname"><a href="ross_8h.html">ross.h</a></div></div>
<div class="ttc" id="aarch64_8h_html_abcd6b97b84bebf1f961f85cd24b56c60"><div class="ttname"><a href="aarch64_8h.html#abcd6b97b84bebf1f961f85cd24b56c60">tw_clock</a></div><div class="ttdeci">uint64_t tw_clock</div><div class="ttdef"><b>Definition:</b> <a href="aarch64_8h_source.html#l00004">aarch64.h:4</a></div></div>
<div class="ttc" id="tw-opts_8h_html_a0e45b7a88a51dca3fe99d31aae9636c4"><div class="ttname"><a href="tw-opts_8h.html#a0e45b7a88a51dca3fe99d31aae9636c4">TWOPT_GROUP</a></div><div class="ttdeci">#define TWOPT_GROUP(h)</div><div class="ttdef"><b>Definition:</b> <a href="tw-opts_8h_source.html#l00027">tw-opts.h:27</a></div></div>
<div class="ttc" id="armv7l_8c_html_adb6ac59d7f33538cc7ebe7d9e47ec255"><div class="ttname"><a href="armv7l_8c.html#adb6ac59d7f33538cc7ebe7d9e47ec255">tw_clock_init</a></div><div class="ttdeci">void tw_clock_init(tw_pe *me)</div><div class="ttdef"><b>Definition:</b> <a href="armv7l_8c_source.html#l00037">armv7l.c:37</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>
